#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double polynom (double x, double coef[], int n)
{
	int i;
	double znach = 0;
	for (i = n-1; i >= 0; i--)
		znach = znach *x + coef[i];  
	return znach;
}

void main ()
{
	double x, s, znach, coef[1000];
	int i, n=0;

	printf("Vvedite coefficienti: \n ");

	for (i = 0; i < 100000; i++)
	{
		s = scanf(" %lf", &coef[i]);
		if (s==0) 
			break;
		n++;
	}
	
	printf("Vvedite x: \n");
	scanf("%lf", &x);

	printf("znachenie mnogochlena = %f \n", polynom(x,coef,n));

	system("pause");
}